import React from 'react'
import { useLocation } from 'react-router-dom'
import qs from 'qs'
export default function News() {
  const Location = useLocation()
  const { user, id } = qs.parse(Location.search.split('?')[1])

  const state = Location.state

  return (
    <div>
      <p>News</p>
      <p>您的用户名:{user} 您的id:{id}</p>
      {
        state.map(item => {
          return <li>{item.name}</li>
        })
      }
    </div>
  )
}
